function [u] = LaxWendrof(t_max,h)
%���غ��ʽ������ճBurgers����,��t_maxʱ��[-1��1]�䵽��ֵ���
    n = floor(1/h);
    v = 1;
    tau = v*h;
    s = floor(t_max/tau)+1;
    
    %���ó�ʼ�����������������
    length = 2*s+2*n-1;
    
    u = zeros(length, 2);
    u(1:s+n,1) = ones(s+n,1);

    pre =1;
    now =2;
    step = max(1,floor(s/100));
    for t = 2:s
        pre = t-1;
        now = t;
        for i = t-1:length-t+1
            a(i) = (u(i+1,pre)+u(i,pre))/2;
        end
        
        for i = t:length-t+1
            temp = (a(i)*(u(i+1,pre)^2/2-u(i,pre)^2/2)-a(i-1)*(u(i,pre)^2/2-u(i-1,pre)^2/2))*(tau^2/(2*h^2));
            u(i,now)=u(i,pre)-(u(i+1,pre)^2/2-u(i-1,pre)^2/2)*(tau/(2*h))+temp;
        end
        if mod(t-1,step)==0
            plot((-1:1/n:1),u(s:length-s+1,now));
            axis([-1,1,-1,2]);
            title(strcat('LaxWendrof tmax:',num2str(t_max),' h:',num2str(h)));
            pause(0.04)
        end
        temp = pre;
        pre = now;
        now =temp;
    end
    u = u(s:length-s+1);
    %mesh((),u);
    %axis([-1,1,-1,2]);
    %pause(0.1);
end